package com.stock.demo.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.stock.demo.R;
import com.stock.demo.adapter.viewholder.StockViewHolder;
import com.stock.demo.model.SelfSelectMenuBean;

import java.util.ArrayList;

/**
 * Created by XuZhaoyu on 2017/7/1.
 */

public class SelfSelectMenuAdapter extends StockBaseAdapter<SelfSelectMenuBean> {

    public SelfSelectMenuAdapter(Context context, ArrayList<SelfSelectMenuBean> data) {
        super(context, data);
    }

    @Override
    public int setLayoutResId() {
        return R.layout.view_self_select_menu_item;
    }

    @Override
    public void onBindViewHolder(StockViewHolder holder, int position) {
        View itemView = holder.itemView;
        TextView tvContent = (TextView) itemView.findViewById(R.id.tv_menu_content);
        ImageView ivChooseMark = (ImageView) itemView.findViewById(R.id.iv_menu_choose_mark);
        SelfSelectMenuBean item = getItem(position);
        if (item != null) {
            tvContent.setText(item.mTitle);
            if (item.mIsChecked) {
                ivChooseMark.setVisibility(View.VISIBLE);
            } else {
                ivChooseMark.setVisibility(View.INVISIBLE);
            }
        }
    }
}
